<%@page import="java.net.URLDecoder"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Cookie</title>
</head>
<body>
	<%
		Cookie[] cookies = request.getCookies();
		String user = "";
		String date = "";
		if (cookies != null && cookies.length > 0) {
			for (Cookie cookie : cookies) {
				String[] strs = cookie.getValue().split("#");
				if (strs!= null && strs.length > 1) {
					user = URLDecoder.decode(cookie.getValue().split("#")[0]);
					date = cookie.getValue().split("#")[1];
				}
			}
		}
		if ("".equals(user) && "".equals(date)) {
	%>
		<label>游客你好，欢饮初次光临</label>
		<form action="deal.jsp" method="post">
			<label>请输入姓名：</label><input type="text" id="name" name="user" style="width: 120px;"><br>
			<input type="submit" id="submit" name="submit" value="提交">
		</form>
	<%
		} else {
	%>
		<label>欢饮<%=user %>,再次光临</label><br>
		<label>您注册时间为：<%=date %></label>
	<%
		}
	%>
		
</body>
</html>